package com.fly.util;

import com.google.common.base.CaseFormat;

/**
 * Created by frinder on 2018/1/4.
 */
public class StringUtils {

    /**
     * 下划线转大写
     *
     * @param resource
     * @return
     */
    public static String underline2Upper(String resource) {
        return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, resource);
    }


    /**
     * 首字母转大写
     *
     * @param resource
     * @return
     */
    public static String first2Upper(String resource) {
        return CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, resource);
    }

    /**
     * 首字母转小写
     *
     * @param resource
     * @return
     */
    public static String first2Lower(String resource) {
        return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, resource);
    }


    public static void main(String[] args) {
        System.out.println(underline2Upper("abc_efd"));
        System.out.println(first2Upper("abc_efd"));
        System.out.println(first2Lower("Abc_efd"));
    }
}
